package f.orm.dao;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;

import f.tools.PropertyReader;

@WebServlet(urlPatterns = "/dbInit", loadOnStartup=1)
public class DBInitializationServlet extends HttpServlet {

	public void init() {
		try {
			int connectionPoolSize = Integer.parseInt(PropertyReader.getProperty("db.properties", "connectionPoolSize"));
			ConnectionPool pool = ConnectionPool.getInstance(new int[] { connectionPoolSize });
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void destroy() {
		try {
			ConnectionPool pool = ConnectionPool.getInstance(new int[0]);
			pool.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}